package demo5;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 石方旭
 * Date: 2022-07-30
 * Time: 19:46
 */
//静态内部类方式-->懒汉模式
public class Singleton {

   private Singleton(){}

    private static final class SingletonHolder{
       private static final Singleton instance = new Singleton();
    }

    private static Singleton getInstance(){
       return SingletonHolder.instance;
    }

}
